package com.tiago.home;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class KnowlegeAndroidMainActivity extends Activity implements
		OnClickListener
{

	Button goToInternalActivity, goToExternalActivity;

	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.main_layout);

		goToInternalActivity = (Button) findViewById(R.id.goToInternalActivityButton);
		
		goToExternalActivity = (Button) findViewById(R.id.goToExternalActivityButton);

		goToInternalActivity.setOnClickListener(this);
		
		goToExternalActivity.setOnClickListener(this);
	}

	@Override
	public void onClick(View v)
	{
		if (v == goToInternalActivity)
		{
			Intent it = new Intent(this, InternalActivity.class);
			
			startActivity(it);
		}

		if (v == goToExternalActivity)
		{

			Intent intent = new Intent("android.intent.action.MAIN");
			
			intent.setComponent(new ComponentName("com.tiago.external", "com.tiago.external.ExternalActivityActivity"));
			
			startActivity(intent);
		}

	}
}